package com.opal.jx.controller;

import com.opal.jx.entity.JxAssessReception;
import com.opal.jx.service.JxIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("jxIndex")
public class JxIndexController {

    @Autowired
    private JxIndexService jxIndexService;

    /**
     * 根据组织获取部门：easyui-treegrid   （更改逻辑，已失效）
     * @return
     */
    @RequestMapping("getDeptByPkOrg")
    @ResponseBody
    public Object getDeptByPkOrg(String pkOrg){
        Object object=jxIndexService.getDeptByPkOrgService(pkOrg);
        return object;
    }

    /**
     * 根据部门获取岗位最顶层的岗位信息：easyui-datagrid
     * @return
     */
    @RequestMapping("getPostByDept")
    @ResponseBody
    public Object getPostByDept(String pkDept){
        Object object=jxIndexService.getPostByDeptService(pkDept);
        return object;
    }

    /**
     * 双击岗位表中的表格触发事件：获取岗位中所有子类型的数组岗位
     * @return
     */
    @RequestMapping("selectSonPost")
    @ResponseBody
    public Object selectSonPost(String pkDept,String postName){
        Object object=jxIndexService.selectSonPostService(pkDept,postName);
        return object;
    }

    /**
     * 根据部门pkDept和岗位获取相关的人员信息：为easyui-datagrid的人员信息表封装数据(暂时废的)
     * @return
     */
    @RequestMapping("getEmpByPkDeptAndPostId")
    @ResponseBody
    public Object getEmpByPkDeptAndPostId(String pkDept,Long postId){
        Object object=jxIndexService.getEmpByPkDeptAndPostId(pkDept,postId);
        return object;
    }


    /**
     *  根据多个岗位id、年、月、岗位名称、部门获取数据；加载配制车间各个岗位的页面时候触发此接口和日期；addPZCJData方法中
     * @return
     */
    @RequestMapping("pzcj/getEmpByPkDeptAndPostIds")
    @ResponseBody
    public Object getEmpByPkDeptAndPostIds(@RequestBody JxAssessReception jxAssessPzcjReception){
        Object object=jxIndexService.getEmpByPkDeptAndPostIds(jxAssessPzcjReception);
        return object;
    }

    /**
     * addBZCJData的方法中触发此接口，获取相关岗位名称中的绩效员工信息；
     * @param jxAssessPzcjReception  岗位名称、年、月 、部门pkDept
     * @return
     */
    @RequestMapping("getEmpInfo")
    @ResponseBody
    public Object getEmpInfo(JxAssessReception jxAssessPzcjReception){
        Object object=jxIndexService.getEmpInfoService(jxAssessPzcjReception);
        return object;
    }


    /**
     * 根据部门和职位获取考核内容：easyui-datagrid
     * @param postId
     * @return
     */
    @RequestMapping("getAssessContentData")
    @ResponseBody
    public Object getAssessContentData(Long postId){
        Object object=jxIndexService.getAssessContentDataService(postId);
        return object;
    }

}
